package com.hsh.enums;

import com.hsh.tools.handler.BusinessException;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * <p>
 * 数据字典类型
 * </p>
 *
 * @author huangsihai
 * @date 8/29/2021
 */
@Getter
@AllArgsConstructor
public enum DictTypeRule {

    PT_DICT(1, "普通字典"),
    LD_DICT(2, "联级字典"),
    XXK_LD_DICT(3, "选项卡+联动字典");

    private Integer key;
    private String desc;

    public static DictTypeRule whetherExists(Integer key) {
        for (DictTypeRule rule : DictTypeRule.values()) {
            if (rule.getKey().equals(key)) {
                return rule;
            }
        }
        throw new BusinessException("数据错误");
    }
}
